<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    用户名：<input type="text"><br />
    密  码:<input type="text"><br />
    验证码：<input type="text" id="yjm"><span id="n">0000</span><br />
    <button id="btn">登录</button><span id="m"></span>

    <script src="./js/inder.js"> </script>
    <script>
        window.onload = function () {
        var oSpan = document.getElementById("n")
        console.log(oSpan.innerHTML);

        n.onclick = function () {
            var a = randomNum(0, 10).toString()
            var b = randomNum(0, 10).toString()
            var c = randomNum(0, 10).toString()
            var d = randomNum(0, 10).toString()
            var shu =a+b+c+d
            oSpan.innerHTML = shu
        }
        
        btn.onclick=function(){
            console.log(123)
            if(n.innerHTML==yjm.value){
                m.style.color="red"
                m.innerHTML="验证码正确,请登录！"
            }else{
                m.style.color="green"
                m.innerHTML="验证码错误，请重新输入！"
            }
        }
    }
    </script>
</body>
</html>